﻿using Shop.RemoteModel.Category;
using Shop.RemoteModel.Category.Model;
using Shop.Service.Interface;
using WeDonekRpc.Client.Interface;

namespace Shop.Service.RpcEvent
{
    internal class CategoryEvent : IRpcApiService
    {
        private readonly ICategoryService _Service;

        public CategoryEvent (ICategoryService service)
        {
            this._Service = service;
        }
        public void DeleteCategory (DeleteCategory obj)
        {
            this._Service.Delete(obj.Id);
        }
        public CategoryDatum GetCategory (GetCategory obj)
        {
            return this._Service.Get(obj.Id);
        }
        public Dictionary<long, int> SetCategorySort (SetCategorySort obj)
        {
            return this._Service.SetSort(obj.Id, obj.Sort);
        }
        public bool SetCategory (SetCategory set)
        {
            return this._Service.Set(set.Id, set.Datum);
        }
        public void EnableCategory (EnableCategory obj)
        {
            this._Service.Enable(obj.Id);
        }
        public CategoryTree[] GetCategoryTree (GetCategoryTree obj)
        {
            return this._Service.GetTree(obj.GetParam);
        }
        public void DisableCategory (DisableCategory obj)
        {
            this._Service.Disable(obj.Id);
        }
        public CategoryFullTree[] GetCategoryFullTree ()
        {
            return this._Service.GetFullTree();
        }
        public void MoveCategory (MoveCategory obj)
        {
            this._Service.Move(obj.Id, obj.ToId);
        }

        public long AddCategory (AddCategory add)
        {
            return this._Service.Add(add.Category);
        }
    }
}
